import { outputFileSync } from "fs-extra";
import { join, resolve } from "path";
import { getRouter } from "../utils";
import { AutoBase } from "./auto-base";
export enum VueFileType {
  'ts' = ".ts",
  'none' = ".js"
}
export class VueAuto extends AutoBase {
  constructor() {
    super();
  }
  writeFile() {
    let json = this.getConfigJson();
    let allJson = this.createAllJson();
    let str = getRouter(JSON.parse(allJson));
    outputFileSync(join(this.ROOT_DIR, "router", `routers${VueFileType[json.type]}`), str);
    outputFileSync(join(this.ROOT_DIR, "router", `allPage.json`), allJson);
  }
}
// delete require.cache[require.resolve('./myJson.js')];
// let myJson = require('./myJson.js');
